/*
{*******************************************************************}
{                                                                   }
{       KS-GANTT DotNet Library                                     }
{       Gantt-Charting Control for Windows Forms                    }
{                                                                   }
{       Copyright (c) 2009 - 2012 by Kroll-Software                 }
{       All Rights Reserved                                         }
{                                                                   }
{   This code is provided 'as is',                                  }
{   without warranties of any kind. Use at your own risk.           }                                                              
{                                                                   }
{   As a license holder of the KS-Gantt Control,                    }
{   you may freely redistribute executables based on                }
{   and created with these contents.                                }
{   You can modify the source code to meet your needs.              }
{                                                                   }
{   However, you must not publish, redistribute or transfer         }
{   this source code to 3rd parties under any conditions.           }
{                                                                   } 
{*******************************************************************}
*/

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using KS.Common;

namespace MiGuava.SqlServer
{
    public partial class SqlServerConnectDialog : Form
    {
        public bool bOK;        

        public SqlServerConnectDialog()
        {
            InitializeComponent();

            bOK = false;
        }	        
		
		public string UserName
		{
			get
            {
				return ucSqlServerConnect1.UserName;
			}
			set
			{
				ucSqlServerConnect1.UserName = value;
			}
		}
		
		
		public string Password
		{
			get
            {
                return ucSqlServerConnect1.Password;
			}
			set
			{
                ucSqlServerConnect1.Password = value;
			}
		}
		
		public string Server
		{
			get
            {
                return ucSqlServerConnect1.Server;
			}
			set
			{
                ucSqlServerConnect1.Server = value;
			}
		}
		
		public string Database
		{
			get
            {
                return ucSqlServerConnect1.Database;
			}
			set
			{
                ucSqlServerConnect1.Database = value;
			}
		}
		
		public SQLAuthTypes SQLAuth
		{
			get
            {				
                return ucSqlServerConnect1.SQLAuth;
			}
			set
			{
                ucSqlServerConnect1.SQLAuth = value;
			}
		}
		
		public string ConnectionString
		{
			get
            {
                return ucSqlServerConnect1.ConnectionString;
			}
		}

        private void SqlServerConnectDialog_Load(object sender, EventArgs e)
        {
            bOK = false;            
        }

        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);
            ucSqlServerConnect1.InitLoad();
        }

        
        private void cmdOK_Click(object sender, EventArgs e)
        {
            if (!ucSqlServerConnect1.IsValid(true, true))
            {
                return;
            }
            bOK = true;
            this.Close();
        }
                

        private void cmdTestConnection_Click(object sender, EventArgs e)
        {
            ucSqlServerConnect1.TestConnection();
        }               
    }
}